<include file="header"/>
<body>
<div class="wraper">
	<div class="header">
        <span class="headertxt font-white">
            {BEESCRM:$act['act_name']}
        </span>
	</div>
	<div class="coupon">
		<div class="Coupons-background">
			<img src="/assets/coupon/images/bg.png" alt=""/>
			<div class="component text-center font-green flex">
				{BEESCRM:$coupon['title']}
			</div>
		</div>
	</div>
	<p class="text-center font-white font-16">有效期：{BEESCRM:$coupon['start_time']|date="Y-m-d",###} - {BEESCRM:$coupon['end_time']|date="Y-m-d",###}</p>
	<if condition="$is_get eq 1">
		<a href="javascript:void(0);" class="btn text-center">该优惠券已被领取</a>
		<elseif condition="$is_get eq 2" />
		<a href="javascript:void(0);" class="btn text-center">该优惠券已转赠</a>
		<else/>
		<a href="javascript:void(0);" class="btn text-center get_coupon">立即领取</a>
	</if>

	<input type="hidden" id="user_id" value="{BEESCRM:$user_id}">
	<input type="hidden" id="from_user_id" value="{BEESCRM:$from_user_id}">
	<input type="hidden" id="record_id" value="{BEESCRM:$record_id}">
	<input type="hidden" id="account_id" value="{BEESCRM:$account_id}">
</div>

<script src="/assets/coupon/js/jquery-2.1.0.min.js"></script>
<script src="/assets/base/ecs/js/jq.utils.js"></script>
<script src="/assets/bower_components/sweetalert/lib/sweet-alert.min.js"></script>
<script src="/assets/public/layermobile/layer.js"></script>
<link rel="stylesheet" href="/assets/bower_components/sweetalert/lib/sweet-alert.css?v={BEESCRM:$time}">
<!--分享-->
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<include file="share"/>
<script>
	var height=$(window).height();
	$('.wraper').css('height',height);
	$(function(){
		var user_id = $('#user_id').val();
		var account_id = $('#account_id').val();
		var from_user_id = $('#from_user_id').val();
		var record_id = $('#record_id').val();
		$('.get_coupon').on('click',function(){
			$.ajax({
				url: "/coupon/coupon/getCoupon",
				type: "post",
				dataType: 'json',
				data:{user_id:user_id,account_id:account_id,coupon_id:"{BEESCRM:$coupon['coupon_id']}",from_user_id:from_user_id,record_id:record_id},
				success:function(data){
					if (data.status == 'S') {
						$.alert('success', data.message);
						setTimeout(window.location.href=data.url,2000);
					}else{
						$.alert('error',data.message);
					}
				}
			})
		});
	});
</script>
</body>
</html>